import axios from 'axios'

// const TestURL = 'http://mobilecdnbj.kugou.com/'
// const KuGouURL = 'http://localhost:3001/'
const NeteaseCloudMusicApi = 'http://localhost:3000'
// const NeteaseCloudMusicApi = 'https://neteasecloudmusicapi.vercel.app'

let userData = JSON.parse(localStorage.getItem('userData'))
let token = userData.token
let cookie = userData.cookie
const request = axios.create({
  baseURL: NeteaseCloudMusicApi,
  timeout: 20000,
  headers: {
    // Authorization: "Bearer " + token,
    // cookie:cookie
  }
})

//请求拦截
request.interceptors.request.use(config => {
  return config
}, error => {
  return Promise.reject(error)
});

//相应拦截
request.interceptors.response.use(res => {
  return res
})

export { request }
